<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="cmcc.operator.*" %>
<%@include file="../checkLoginSession.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<% 
	Operator operator = (Operator)session.getAttribute("operator");
	System.out.println("addOperator.jsp----------------");
	operator.print();
	if(!operator.getIs_admin().equals("Y")){
		response.sendRedirect("../frameSet/blank.jsp?noright=noopratorlistright");
		return;
	}
%>
<% 
	int wide = 5;
	String strPageNo = request.getParameter("pageNo");
	int pageNo=1;
	if(strPageNo!=null && !strPageNo.equals("")){
		pageNo = Integer.parseInt(strPageNo);		
	}	
	
	int count = Operator.getCount();
	int allPage = count%wide==0 ? count/wide : count/wide+1;	
	if(pageNo<1){
		pageNo=1;
	}
	if(pageNo>allPage){
		pageNo=allPage;
	}
	
	System.out.println("共 "+allPage+" 页  ------- 第 "+pageNo+" 页");
	int start = (pageNo-1) *5;
	ArrayList<Operator> list = Operator.getList(start, wide);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>My JSP 'ListAllOperators.jsp' starting page</title>
		<style>
a {
	text-decoration: none
}
</style>
		<link href="../style/stylet.css"
			rel="stylesheet" type="text/css">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
    	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<!--
	查询所有操作员
	-->

		<style type="text/css">
<!--
.STYLE3 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>

		<script type="text/javascript">
	function confirmDel(){
		var r=document.getElementsByName("ids");
		var strMsg='';
		var snum=0;
		for(var i=0;i<r.length;i++){
		   if(r[i].checked){
		   	return;
		   }
		} 
		alert("请选中至少一项");
		return false;
	}	
	
	function checkMsg(){

	}
</script>
	</head>
	<body link="#73A822" alink="#73A822" vlink="#73A822">
		<font size="2">您现在的位置：>>操作员列表</font>
		<hr>
		<div align="center">
			<form action="searchResult.jsp" method="POST"
				onsubmit="return checkMsg();">
				<font size="2">操作员姓名:</font>
				<input type="text" name="Operator_Name" id="Operator_Name" size="8">
				<input type="hidden" name="flag" value="findSomeone">
				<font size="2">操作员编号:</font>
				<input type="text" name="Operator_ID" id="Operator_ID" size="8">			
					<input type="submit" class="tb_top_1" value="立即查询">			
			</form>
		</div>

		<br>
		<form action="delOperator.jsp" method="POST"
			onsubmit="return confirmDel();">
			<input type="hidden" name="flag" value="delete">
			<table cellspacing="1" class="table" align="center">
				<tbody>
					<tr class="table_header">
						<td>
							<div align="center" class="STYLE3">
								选中
							</div>
						</td>
						<td>
							<div align="center" class="STYLE3">
								编号
							</div>
						</td>
						<td>
							<div align="center" class="STYLE3">
								姓名
							</div>
						</td>
						
						<td>
							<div align="center" class="STYLE3">
								权限
							</div>
						</td>
						<td>
							<div align="center" class="STYLE3">
								操作
							</div>
						</td>
					</tr>
					<!-- 请注意:这里我们需要循环显示所有的记录信息 -->
					<% 
						for(Iterator i = list.iterator() ;i.hasNext();){
							Operator o = (Operator)i.next();
							
					%>
					<tr align="center" class="row2" onMouseOver="this.className='row1'"
						onMouseOut="this.className='row2'">

						<td>
							<input type="checkbox" name="ids" id="ids"
								value="<%=o.getOperator_id() %>">
						</td>
						<td>
							<%=o.getOperator_id() %>
						</td>
						<td>
							<%=o.getOperator_name() %>
						</td>
				
						<td>
							<%=o.getPermission() %>
						</td>
						<td>
							<a href="changeOperator.jsp?operator_id=<%=o.getOperator_id() %>">修改</a>
						</td>

					</tr>
					<% 
						}
					%>				
				</tbody>
			</table>
			<br>
			<br>
			<div align="center">

				
					<input type="submit" class="tb_top_1" value="立即删除">
				

				<br>
				<br>
				<p class="paging">
					
					<a href="operatorList.jsp?pageNo=1"><<首页</a>
					|
					<a href="operatorList.jsp?pageNo=<%=pageNo-1%>"><上一页</a>
					|共<%=allPage %>页|第<%=pageNo %>页|
					
					<a
						href="operatorList.jsp?pageNo=<%=pageNo+1%>">下一页&gt;</a>|
					<a
						href="operatorList.jsp?pageNo=<%=allPage%>">尾页&gt;&gt;</a>
					
				</p>
			</div>
		</form>
		<div align="center">
			<form action="operatorList.jsp" method="get">
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 跳转
				<input type="text" name="pageNo" size="2" value="<%=pageNo%>">
				页
				<input type="submit" value="跳">
			</form>
		</div>
		<font color="#0033FF"> </font>
		
	</body>
</html>
